<template>
	<view class="layout">
		<view class="navBar">
			<view class="statusBar" :style="{height:getStatusBarHeight() + 'px'}">

			</view>
			<view class="titleBar" :style="{height:getTitleBarHeight() + 'px'}">
				<view class="title">{{title}}</view>
				<navigator url="/pages/search/search" class="search">
					<uni-icons type="search" color="#888" size="18"></uni-icons>
					<text>搜索</text>
				</navigator>
			</view>
		</view>
		<view class="fill" :style="{height:getNavBarHeight() + 'px'}">

		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import {getStatusBarHeight,getTitleBarHeight,getNavBarHeight} from '@/utils/system.js'
	const props = defineProps({
		title:{
			type:String,
			default:"标题"
		}
	})
/* let statusBarHeight = ref();
let system = uni.getSystemInfo({
	success: (res) => {
	    statusBarHeight.value = res.statusBarHeight; // 获取状态栏高度
	    console.log("状态栏高度:", statusBarHeight);
	  }
}) */
/* let menu = uni.getMenuButtonBoundingClientRect()
let titleBarHeight = menu.height + (menu.top - statusBarHeight.value)*2
console.log("胶囊按钮",menu)
console.log("System",system)
console.log("statusBarHeight",statusBarHeight )*/
</script>

<style lang="scss" scoped>
	.layout {
		
		.navBar {
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 10;
			background:
			linear-gradient(to bottom, transparent 0%, #fff 400rpx),
			linear-gradient(to right, #beecd8, #f4e5d8);
			.statusBar {
				// border: 1px solid red;
			}

			.titleBar {
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				height: 100rpx;

				.title {
					font-size: 42rpx;
					font-weight: 700;
					color: $text-font-color-1;
				}

				.search {
					width: 220rpx;
					height: 50rpx;
					border-radius: 60rpx;
					background: rgba(255, 255, 255, 0.4);
					border: 1px solid #fff;
					margin-left: 30rpx;
					color: #999;
					font-size: 28rpx;
					display: flex;
					align-items: center;

					.icon {
						margin-left: 5rpx;
					}

					.text {
						padding-left: 10rpx;
					}
				}
			}

		}

	}
</style>